/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts.form;

import com.myapp.hibernate.model.MuestraApuesta;
import com.myapp.hibernate.model.MuestraCombate;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author ressac
 */
public class ApostarForm extends org.apache.struts.action.ActionForm {
    private int idApuesta;
    private int idCombate;
    private int idBoxeador;
    private int cantidad;
    private float cuota;
    private MuestraCombate combate;

    public int getIdApuesta() {
        return idApuesta;
    }

    public void setIdApuesta(int idApuesta) {
        this.idApuesta = idApuesta;
    }

    public int getIdBoxeador() {
        return idBoxeador;
    }

    public void setIdBoxeador(int idBoxeador) {
        this.idBoxeador = idBoxeador;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public float getCuota() {
        return cuota;
    }

    public void setCuota(float cuota) {
        this.cuota = cuota;
    }

    public int getIdCombate() {
        return idCombate;
    }

    public void setIdCombate(int idCombate) {
        this.idCombate = idCombate;
    }

    public MuestraCombate getCombate() {
        return combate;
    }

    public void setCombate(MuestraCombate combate) {
        this.combate = combate;
    }

    /**
     *
     */
    public ApostarForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (this.getCantidad() <= 0) {
            errors.add("cantidad", new ActionMessage("error.cantidad"));
        }else if (this.idBoxeador == 0) {
            errors.add("boxeador", new ActionMessage("error.boxeador"));
        }
        return errors;
    }
}
